import type { RouteRecordRaw } from 'vue-router'

const nodeRoutes: RouteRecordRaw[] = [
  {
    path: 'node/list',
    name: 'NodeList',
    component: () => import('@/views/node/node-list'),
    meta: {
      title: '节点列表',
      showPageHeader: true,
      showBack: false,
      currentActiveMenu: 'NodeList'
    }
  },
  {
    path: 'node-management/:id',
    name: 'NodeManagement',
    redirect: { name: 'NodeBaseConfig' },
    meta: {
      title: '节点管理',
      parentTitle: '节点列表',
      showPageHeader: true,
      showBack: true,
      parentName: 'Node',
      currentActiveMenu: 'NodeList',
      tabs: [
        {
          key: 'NodeBaseConfig',
          title: '基础配置'
        },
        {
          key: 'NodeDiskConfig',
          title: '磁盘配置'
        },
        {
          key: 'NodeWafConfig',
          title: 'WAF配置'
        }
      ]
    },
    children: [
      {
        path: 'base-conf',
        name: 'NodeBaseConfig',
        component: () => import('@/views/node/node-list/modules/base-conf')
      },
      {
        path: 'disk-conf',
        name: 'NodeDiskConfig',
        component: () => import('@/views/node/node-list/modules/disk-conf')
      },
      {
        path: 'waf-conf',
        name: 'NodeWafConfig',
        component: () => import('@/views/node/node-list/modules/waf-conf')
      }
    ]
  },
  {
    path: '/node/statistic',
    name: 'NodeStatistic',
    redirect: { name: 'NodeBandwidth' },
    meta: {
      title: '数据统计',
      showPageHeader: true,
      showBack: false,
      currentActiveMenu: 'NodeStatistic',
      tabs: [
        {
          title: '带宽',
          key: 'NodeBandwidth'
        },
        {
          title: '连接数',
          key: 'NodeLink'
        },
        {
          title: 'CPU使用率',
          key: 'NodeCpu'
        },
        {
          title: '内存使用率',
          key: 'NodeMemory'
        }
      ]
    },
    children: [
      {
        path: 'bandwidth',
        name: 'NodeBandwidth',
        component: () => import('@/views/node/statistic/bandwidth')
      },
      {
        path: 'link',
        name: 'NodeLink',
        component: () => import('@/views/node/statistic/link')
      },
      {
        path: 'cpu',
        name: 'NodeCpu',
        component: () => import('@/views/node/statistic/cpu')
      },
      {
        path: 'memory',
        name: 'NodeMemory',
        component: () => import('@/views/node/statistic/memory')
      }
    ]
  },
  {
    path: '/node/version',
    name: 'NodeVersion',
    component: () => import('@/views/node/version/NodeVersion.vue'),
    meta: {
      title: '版本管理',
      showPageHeader: true,
      showBack: false,
      currentActiveMenu: 'NodeVersion'
    }
  },
  {
    path: '/node/cascade',
    name: 'NodeCascade',
    component: () => import('@/views/node/cascade/CascadeView.vue'),
    meta: {
      title: '级联管理',
      showPageHeader: true,
      showBack: false,
      currentActiveMenu: 'NodeCascade'
    }
  },
  {
    path: '/node/safe',
    name: 'SecurityConfig',
    redirect: { name: 'NodeCustomRules' },
    meta: {
      title: '安全配置',
      showPageHeader: true,
      showBack: false,
      currentActiveMenu: 'SecurityConfig',
      tabs: [
        {
          key: 'NodeCustomRules',
          title: '自定义规则'
        },
        {
          key: 'NodeRateLimit',
          title: '速率限制'
        },
        {
          key: 'NodeWhiteList',
          title: '白名单'
        }
      ]
    },
    children: [
      {
        path: 'node/customRules',
        name: 'NodeCustomRules',
        component: () => import('@/views/node/security-config/custom-rules'),
        meta: {
          title: '安全配置',
          showPageHeader: true,
          showBack: false,
          currentActiveMenu: 'SecurityConfig'
        }
      },
      {
        path: 'node/rateLimit',
        name: 'NodeRateLimit',
        component: () => import('@/views/node/security-config/rate-limit'),
        meta: {
          title: '安全配置',
          showPageHeader: true,
          showBack: false,
          currentActiveMenu: 'SecurityConfig'
        }
      },
      {
        path: 'node/whiteList',
        name: 'NodeWhiteList',
        component: () => import('@/views/node/security-config/white-list'),
        meta: {
          title: '安全配置',
          showPageHeader: true,
          showBack: false,
          currentActiveMenu: 'SecurityConfig'
        }
      }
    ]
  },
  {
    path: 'node/deploy/:id/:name',
    name: 'NodeDeploy',
    meta: {
      title: '调整部署',
      parentTitle: '安全配置',
      showBack: true,
      showPageHeader: true,
      parentName: 'SecurityConfig',
      currentActiveMenu: 'SecurityConfig'
    },
    component: () =>
      import('@/views/node/security-config/components/NodeDeployView.vue')
  },
  {
    path: '/node/port',
    name: 'PortConfig',
    component: () => import('@/views//node/port-config'),
    meta: {
      title: '端口配置',
      showPageHeader: true,
      showBack: false,
      currentActiveMenu: 'PortConfig'
    }
  },
  {
    path: '/node/log',
    name: 'NodeLog',
    redirect: { name: 'SecurityOverview' },
    meta: {
      title: '安全日志',
      showPageHeader: true,
      showBack: false,
      currentActiveMenu: 'NodeLog',
      tabs: [
        {
          key: 'SecurityOverview',
          title: '安全概览'
        },
        {
          key: 'LogDetails',
          title: '日志明细'
        }
      ]
    },
    children: [
      {
        path: 'safe',
        name: 'SecurityOverview',
        component: () => import('@/views/node/log/safe')
      },
      {
        path: 'details',
        name: 'LogDetails',
        component: () => import('@/views/node/log/detail/LogDetails.vue')
      }
    ]
  }
]
export default nodeRoutes
